﻿using Algoritmia.DataStructures.Lists;
using System.Numerics;

namespace Algoritmia.Problems.Fourier
{
    public interface IDiscreteFourierTransform
    {
        IList<Complex> Transform(IList<Complex> complexs);
    }

    public static class DiscreteFourierTransformExtensions
    {
        public static IList<Complex> InverseTransform(this IDiscreteFourierTransform dft, IList<Complex> complexs)
        {
            var r = dft.Transform(complexs);
            int N = r.Count;
            for (int i =0; i < N; i++)
            {
                r[i] /= N;
            }
            return r;
        }
    }
}
